﻿/*************************************************************************

XLoad\main.cpp

	-by Miles Chen (stainboyx@hotmail.com) 2009-1-29

*************************************************************************/

#include "s-int.h"

BOOL SingleInstance(LPCWSTR lpName)
{
	HANDLE hMutex = CreateMutexW(NULL, TRUE, lpName);
	if(GetLastError() == ERROR_ALREADY_EXISTS)
	{
		ReleaseMutex(hMutex);
		return FALSE;
	}
	return TRUE;
}

int CALLBACK WinMain(
  _In_  HINSTANCE hInstance,
  _In_  HINSTANCE hPrevInstance,
  _In_  LPSTR lpCmdLine,
  _In_  int nCmdShow
)
{
	if(!SingleInstance(L"TLoad_Runtime"))
		return -1;

	InitCommonControls();
	Window::Show(NULL, IDD_FORM, DialogProc);
	ExitProcess(0);

	return 0;
}